<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri='http://java.sun.com/jsp/jstl/core' prefix='c'%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>View photo</title>
</head>
<body>

<a href="./LogoutController">Log out</a> <br/>
<a href="./editUser.jsp">Edit personal information</a> <br/>
<a href="./HomeController">Home</a> <br/>

<img alt="Greška, nema slike." src="${ requestScope.photo.location }">

<form action="./EditPhotoController" method="post" accept-charset="UTF-8"
		enctype="multipart/form-data">
		
	<input type="hidden" name="id" value="${ requestScope.photo.id }">
	
	<table>
		<tr>
			<td><label for="title">Title</label></td>
			<td><input type="text" name="title" value="${ requestScope.photo.title }"></td>
		</tr>
		<tr>
			<td><label for="description">Description</label></td>
			<td><textarea name="description" >${ requestScope.photo.description }</textarea></td>
		</tr>
		<tr>
			<td><label for="public">Public</label></td>
			<td>
				<c:if test="${ requestScope.photo.publiclyAvailable }">
					<input type="checkbox" name="public" checked="checked">
				</c:if>
				<c:if test="${ requestScope.photo.publiclyAvailable == false }">
					<input type="checkbox" name="public">
				</c:if>
			</td>
		</tr>
		<tr>
			<td><label for="tags_allowed">Tags allowed</label></td>
			<td>
				<c:if test="${ requestScope.photo.tagsAllowed }">
					<input type="checkbox" name="tags_allowed" checked="checked">
				</c:if>
				<c:if test="${ requestScope.photo.tagsAllowed == false }">
					<input type="checkbox" name="tags_allowed">
				</c:if>
			</td>
		</tr>
		<tr>
			<td><label for="notes_allowed">Notes allowed</label></td>
			<td>
				<c:if test="${ requestScope.photo.notesAllowed }">
					<input type="checkbox" name="notes_allowed" checked="checked">
				</c:if>
				<c:if test="${ requestScope.photo.notesAllowed == false }">
					<input type="checkbox" name="notes_allowed">
				</c:if>
			</td>
		</tr>
		<tr>
			<td><label for="comments_allowed">Comments allowed</label></td>
			<td>
				<c:if test="${ requestScope.photo.commentsAllowed }">
					<input type="checkbox" name="comments_allowed" checked="checked">
				</c:if>
				<c:if test="${ requestScope.photo.commentsAllowed == false }">
					<input type="checkbox" name="comments_allowed">
				</c:if>
			</td>
		</tr>
		<tr>
			<td>
				<input type="submit" value="Change photo setting">
			</td>
			<td>
				<a href="./ViewPhotoController?id=${ requestScope.photo.id }"><input type="button" value="Cancel"></a>
			</td>
		</tr>
	</table>
</form>

</body>
</html>